package com.wanmait.movie;

import com.github.pagehelper.PageInfo;
import com.wanmait.movie.entity.Actor;
import com.wanmait.movie.service.ActorService;
import org.elasticsearch.index.engine.Engine;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.ClassPathResource;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;

@SpringBootTest
public class testActorService {
    @Resource
    private ActorService actorService;

    @Test
    public void testActorList(){
        PageInfo<Actor> actorList=actorService.getActorList("we",1,1);
        actorList.getList().forEach(actor -> System.out.println(actor.getName()));
    }

    @Test
    public void testSave(){
        Actor actor = new Actor();
        actor.setId(5).setName("鹿晗").setPic("/lh.jpg").setSort(1).setInsertAdminId(1).setUpdateAdminId(1).setRole("演员");
        System.out.println(actorService.saveOrUpdate(actor));
    }

    @Test
    public void test() throws IOException, URISyntaxException {
        File file = new File(getClass().getClassLoader().getResource("").getPath());
        System.out.println(getClass().getClassLoader().getResource("").getPath());
    }
}
